package com.arges.web.common;

import java.util.Properties;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

/**
 * 动态解密数据库密码放回原集合文件中
 * 
 * @author arges
 * 
 */
public class LoderProperties extends PropertyPlaceholderConfigurer
{
	@Override
	protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
			throws BeansException
	{
		String userName = props.getProperty(Constant.DRIVER_USERNAME);
		props.setProperty(Constant.DRIVER_USERNAME, AESUtils.decrypt(userName, AESUtils.PASSWORD_KEY));
		String password = props.getProperty(Constant.DRIVER_PASSWORD);
		props.setProperty(Constant.DRIVER_PASSWORD, AESUtils.decrypt(password, AESUtils.PASSWORD_KEY));
		super.processProperties(beanFactoryToProcess, props);
	}
}
